package router

import (
	"jgt-oper/src/context"
	"jgt-oper/src/web"

	"github.com/facebookgo/inject"
	"github.com/teambition/gear"
)

// WebLoginMap 注册登录管理路由映射
func WebLoginMap(g *inject.Graph, router *gear.Router) {
	loginWeb := new(web.Login)
	err := g.Provide(&inject.Object{Value: loginWeb})
	if err != nil {
		panic(err)
	}

	router.Get("/current/user", context.WrapContext(loginWeb.GetUserInfo))
	router.Get("/current/menus", context.WrapContext(loginWeb.QueryUserMenus))
	router.Post("/current/updatepwd", context.WrapContext(loginWeb.UpdatePassword))
	router.Post("/login", context.WrapContext(loginWeb.Verify))
	router.Post("/logout", context.WrapContext(loginWeb.Logout))
}
